Skip to content

typed_ast.ast3: arguments.kw_defaults should be list[expr | None]#8645

Merged
AlexWaygood merged 1 commit intomasterfrom
AlexWaygood-typed-ast-bug
Aug 29, 2022
Merged

typed_ast.ast3: arguments.kw_defaults should be list[expr | None]#8645
AlexWaygood merged 1 commit intomasterfrom
AlexWaygood-typed-ast-bug

Conversation

@AlexWaygood
Copy link
Member

>>> from typed_ast import ast3
>>> print(ast3.dump(ast3.parse('def foo(*, arg: int) -> None: ...')))
Module(body=[FunctionDef(name='foo', args=arguments(args=[], vararg=None, kwonlyargs=[arg(arg='arg', annotation=Name(id='int', ctx=Load()), type_comment=None)], kw_defaults=[None], kwarg=None, defaults=[]), body=[Expr(value=Ellipsis())], decorator_list=[], returns=NameConstant(value=None), type_comment=None)], type_ignores=[])

This bug was discovered in python/mypy#13547

```python
>>> from typed_ast import ast3
>>> print(ast3.dump(ast3.parse('def foo(*, arg: int) -> None: ...')))
Module(body=[FunctionDef(name='foo', args=arguments(args=[], vararg=None, kwonlyargs=[arg(arg='arg', annotation=Name(id='int', ctx=Load()), type_comment=None)], kw_defaults=[None], kwarg=None, defaults=[]), body=[Expr(value=Ellipsis())], decorator_list=[], returns=NameConstant(value=None), type_comment=None)], type_ignores=[])
```

This bug was discovered in python/mypy#13547
@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@AlexWaygood AlexWaygood merged commit c72c9a6 into master Aug 29, 2022
@AlexWaygood AlexWaygood deleted the AlexWaygood-typed-ast-bug branch August 29, 2022 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants